define([
  'views/View',
  'hbs!template/actions-template'
], function(View, template){
  var ActionsView = View.extend({
    template: template,
    events: {
      "click a.action":  "throwActionFn"
    },

    initialize: function(options) {
      options || (options = {});
      if(options.collection) {
        this.collection = options.collection;
      }
    },

    throwActionFn: function(e) {
      e.preventDefault();
      var actionName = $(e.currentTarget).data("name");
      this.on("action:"+actionName);
    },
    
    serialize: function() {
      var data = View.prototype.serialize.apply(this, arguments);

      data.actions = this.collection;
      
      return data;
    }
  });
});